宣告函式total()內的int a, int b, int c 稱為"形式參數",功能為用來接收由呼叫程式所傳送過來的資料。
而在main()下的total(1, 2, 3)則稱為實參數,功能為傳遞資料給最上方的宣告函式。
完整程式碼
#include <stdio.h>
int total(int a, int b, int c){//a, b, c 為形式參數
return a * b * c;
}
int main(){
int sum = total(1, 2, 3);
printf("3!的階乘總和為:%d\n", sum);
return 0;
}
I agree We use cookies on this website to enhance your user experience. By clicking any link on this page you are giving your consent for us to set cookies. More info